package com.study.spring.expand;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.Ordered;

/**
 * Created by tan on 2017/6/26.
 */

/**
 * ApplicationContext会自动识别实现BeanFactoryPostProcessor接口的对象，并自动调用
 * BeanFactory并不会自动识别，只能手动调用
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor, Ordered {
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		//此时 bean已经被创建了，并且属性也被赋值了
		Object object = beanFactory.getBean("person");
		BeanDefinition beanDefinition = beanFactory.getBeanDefinition("person");
	}

	@Override
	public int getOrder() {
		return 0;
	}
}
